package cn.memorynine.consumer.controller;

import cn.memorynine.consumer.model.shop.consumer.*;
import lombok.extern.slf4j.Slf4j;
import cn.memorynine.common.model.ResponseWrapper;
import cn.memorynine.consumer.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;

/**
* 用户前台-商城控制器
* @author 代码生成器
*/
@Slf4j
@RestController
@RequestMapping("/consumer/shop")
public class ShopController {
    @Autowired
    private ShopService shopService;

    /**
     * 1.获取商品列表
     * @return
     */
    @RequestMapping("/commodityList")
    public ResponseWrapper commodityList(@RequestBody @Validated CommodityListParam param){
        return shopService.commodityList(param);
    }

    /**
     * 2.商品详情
     * @return
     */
    @RequestMapping("/commodityInfo")
    public ResponseWrapper commodityInfo(@RequestBody @Validated CommodityInfoParam param){
        return shopService.commodityInfo(param);
    }

    /**
     * 3.商品加入购物车
     * @return
     */
    @RequestMapping("/addToCart")
    public ResponseWrapper addToCart(@RequestBody @Validated AddToCartParam param){
        return shopService.addToCart(param);
    }

    /**
     * 4.提交订单
     * @return
     */
    @RequestMapping("/submitOrder")
    public ResponseWrapper submitOrder(@RequestBody @Validated SubmitOrderParam param){
        return shopService.submitOrder(param);
    }

    /**
     * 5.订单付款
     * @return
     */
    @RequestMapping("/payForOrder")
    public ResponseWrapper payForOrder(@RequestBody @Validated PayForOrderParam param){
        return shopService.payForOrder(param);
    }

    /**
     * 6.订单收货
     * @return
     */
    @RequestMapping("/receiveOrder")
    public ResponseWrapper receiveOrder(@RequestBody @Validated ReceiveOrderParam param){
        return shopService.receiveOrder(param);
    }

    /**
     * 7.评论商品
     * @return
     */
    @RequestMapping("/postComment")
    public ResponseWrapper postComment(@RequestBody @Validated PostCommentParam param){
        return shopService.postComment(param);
    }

    /**
     * 8.取消订单
     * @return
     */
    @RequestMapping("/delOrder")
    public ResponseWrapper delOrder(@RequestBody @Validated DelOrderParam param){
        return shopService.delOrder(param);
    }

    /**
     * 9.获取用户地址列表
     * @return
     */
    @RequestMapping("/addressList")
    public ResponseWrapper addressList(@RequestBody @Validated AddressListParam param){
        return shopService.addressList(param);
    }

    /**
     * 10.获取商品分类列表
     * @return
     */
    @RequestMapping("/categoryList")
    public ResponseWrapper categoryList(@RequestBody @Validated CategoryListParam param){
        return shopService.categoryList(param);
    }


}